package Demo1;

public class T9 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println("线程进行中!");
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        thread.start();

//        在main线程中,调用 thread.join()
//        让main线程等待thread线程结束
        thread.join();//线程等待
//        阻塞 使这俩造成了先后关系
        System.out.println("线程完毕之后再打印我这个主线程!");
    }
}
